import zipfile
import os

def zip_directory(directory, zip_file_path):
    with zipfile.ZipFile(zip_file_path, 'w', zipfile.ZIP_DEFLATED) as zipf:
        for root, dirs, files in os.walk(directory):
            for file in files:
                file_path = os.path.join(root, file)
                zipf.write(file_path, os.path.relpath(file_path, directory))

# 要压缩的目录
directory = '.'
# 压缩后的 ZIP 文件路径
zip_file_path = 'dormitory_allocation_system.zip'

zip_directory(directory, zip_file_path)